import extend from 'extend'
export default {
  changeVueKey(state, v) {
    state.vueKey++
  },
  setDataSet(state, v) {
    state.dataSet = extend(true, {}, v)
  },
  updateDataSet(state, v) {
    let keysArray = Object.keys(v)
    for (let key in keysArray) {
      if (key == 'name' || key == 'path') continue
      for (let k of state.dataSet) {
        if (key == k) {
          extend(true, state.dataSet[k], v[key])
          break
        }
      }
    }
  },
  updateLoadTimes(state, payload) {
    if (typeof payload === 'number') {
      state.loadTimes = payload
    } else {
      state.loadTimes++
    }
  },
  setCurrentDate(state, v) {
    state.currentDate = v
  }
}
